import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

import Layout from '../views/layout/Layout.vue'

export const routes = [
  {
    path: '/login',
    component: () => import('@/views/login/Index')
  },
  {
    path: '/register',
    component: () => import('@/views/register/Index')
  },
  {
    path: '',
    component: Layout,
    redirect: 'index',
    children: [{
      path: 'index',
      component: () => import('@/views/homepage/Index'),
      name: 'index',
      meta: { title: '首页' }
    },
    {
      path: 'bookMeeting',
      component: () => import('@/views/bookMeeting/Index'),
      name: 'bookMeeting',
      meta: { title: '预约会议' }
    },
    {
      path: 'joinMeeting',
      component: () => import('@/views/joinMeeting/Index'),
      name: 'joinMeeting',
      meta: { title: '加入会议' }
    },
    {
      path: 'joinMeeting/:code',
      component: () => import('@/views/joinMeeting/Index'),
      name: 'joinMeetingCode',
      meta: { title: '加入会议' }
    },
    {
      path: 'myMeeting',
      component: () => import('@/views/myMeeting/Index'),
      name: 'myMeeting',
      meta: { title: '我的会议' }
    },
    {
      path: 'detailMine/:id',
      component: () => import('@/views/myMeeting/Details_mine'),
      name: 'detailMine',
      meta: { title: '会议详情' }
    },
    {
      path: 'detailJoin/:id',
      component: () => import('@/views/myMeeting/Details_join'),
      name: 'detailJoin',
      meta: { title: '会议详情' }
    },
    {
      path: 'userInfo',
      component: () => import('@/views/userInfo/Index'),
      name: 'userInfo',
      meta: { title: '个人信息' }
    }]
  },
  { path: '*', redirect: 'index' }
]

export default new VueRouter({
  routes
})
